﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace HBattle
{
    public abstract class BaseGameEntity
    {
        private static int nextValidId;

        private int id;

        private void SetId(int val)
        {
            if (val <= nextValidId)
            {
                throw new System.Exception("<BaseGameEntity::SetID>: invalid ID");
            }
            this.id = val;
            nextValidId =val;
        }

        public BaseGameEntity(int id)
        {
            SetId(id);
        }

        public int ID
        {
            get
            {
                return this.id;
            }
        }

        public abstract void Update(float deltaTime);

        public abstract bool HandleMessage(Telegram msg);

    }
}

